#include "Multigrid/MGFactory.h"
#include "Multigrid/TestMultigrid.h"

using namespace std;
using iVec = Vec<int,2>;
using rVec = Vec<Real,2>;

template <class T>
using Vector = std::vector<T>;

int main(int argc, char* argv[]){
  string name = argv[1];
  string file = "../../test/"+name+".json";
  const int num = 3;
  //cout << "--------------------------- Test function F = \\exp(y+\\sin(x)) ---------------------------" << endl;
  D2Func1 f1;
  //cout << "----------------Injection+LinearInterpolation----------------" << endl;
  MGFactory<2,Injection<2>,LinearInterpolation<2>> MGF1(file);
  TestMultigrid<2,Injection<2>,LinearInterpolation<2>> TM1(MGF1);
  //TM1.TestFMVCycle(f1,num);

  //cout << "----------------FullWeightingRestriction+LinearInterpolation----------------" << endl;
  MGFactory<2,FullWeightingRestriction<2>,LinearInterpolation<2>> MGF2(file);
  TestMultigrid<2,FullWeightingRestriction<2>,LinearInterpolation<2>> TM2(MGF2);
  //TM2.TestFMVCycle(f1,num);

  //cout << "----------------Injection+QuadraticInterpolation----------------" << endl;
  MGFactory<2,Injection<2>,QuadraticInterpolation<2>> MGF3(file);
  TestMultigrid<2,Injection<2>,QuadraticInterpolation<2>> TM3(MGF3);
  //TM3.TestFMVCycle(f1,num);

  //cout << "----------------FullWeightingRestriction+QuadraticInterpolation----------------" << endl;
  MGFactory<2,FullWeightingRestriction<2>,QuadraticInterpolation<2>> MGF4(file);
  TestMultigrid<2,FullWeightingRestriction<2>,QuadraticInterpolation<2>> TM4(MGF4);
  //TM4.TestFMVCycle(f1,num);

  
  cout << "--------------------------- Test function F = \\exp(x*y) ---------------------------" << endl;
  D2Func2 f2;
  cout << "----------------Injection+LinearInterpolation----------------" << endl;
  TM1.TestFMVCycle(f2,num);

  cout << "----------------FullWeightingRestriction+LinearInterpolation----------------" << endl;
  TM2.TestFMVCycle(f2,num);

  cout << "----------------Injection+QuadraticInterpolation----------------" << endl;
  TM3.TestFMVCycle(f2,num);

  cout << "----------------FullWeightingRestriction+QuadraticInterpolation----------------" << endl;
  TM4.TestFMVCycle(f2,num);

  
  cout << "--------------------------- Test function F = x + y ---------------------------" << endl;
  D2Func3 f3;
  cout << "----------------Injection+LinearInterpolation----------------" << endl;
  TM1.TestFMVCycle(f3,num);

  cout << "----------------FullWeightingRestriction+LinearInterpolation----------------" << endl;
  TM2.TestFMVCycle(f3,num);

  cout << "----------------Injection+QuadraticInterpolation----------------" << endl;
  TM3.TestFMVCycle(f3,num);

  cout << "----------------FullWeightingRestriction+QuadraticInterpolation----------------" << endl;
  TM4.TestFMVCycle(f3,num);
}
